package cn.goktech.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Email;
import javax.validation.constraints.Pattern;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Person {
    @Pattern(regexp = "[\\u4e00-\\u9fa5]{1,25}",message = "用户名为1-25长度的中文")
    private String name;
    //\\w等价与[A-Za-z0-9_]
    @Pattern(regexp = "\\w{6,14}",message = "密码为6-14长度的字母数字下划线")
    private String password;
    @Range(min = 18,max = 65,message = "年龄在18~65之间")
    private Integer age;
    @Pattern(regexp = "1[0-9]{10}",message = "手机号为11位")
    private String phoneNo;
    @Email(message = "邮箱格式xxx@xxx.xx|.xx")
    private String email;
}
